/**
 * Created by Shinelon on 2017-12-03.
 */
$(function () {
    $('.zi>p>span').click(function () {
        var jia = $(this).index();
        if(jia == 2){
            $(this).addClass('xuanzhong2')
            $(this).siblings().removeClass('xuanzhong')
        }else{
            $(this).addClass('xuanzhong')
            $(this).siblings().removeClass('xuanzhong')
        }
        if(jia == 0){
            $('#tou,.ertou').css('background-color','#000');
            $('#tou div,.ertou div ul li').css('color','#fff')
            $('.li').children('li').children('a').css('color','#fff')
            $('.yuan').css('color','#000')
            var da = document.getElementById('yitu');
            da.className = 'yitu2';
            var logo =document.getElementById('logo1');
            logo.src="images/官方在线商城---Smartisan_03.gif";
            var logo =document.getElementById('ren');
            logo.src="images/官方在线商城---Smartisan_06.gif";
            var logo =document.getElementById('che');
            logo.src="images/官方在线商城---Smartisan_08.gif";
        }else if(jia==1){
            // 换图片及导航栏的颜色2
            $('#tou,.ertou').css('background-color','#4a121d');
            $('#tou div,.ertou div ul li').css('color','#fff')
            $('.li').children('li').children('a').css('color','#fff')
            $('.yuan').css('color','#000')
            var da = document.getElementById('yitu');
            da.className = 'yitu3';
            var logo =document.getElementById('logo1');
            logo.src="images/坚果-Pro-2---红---概览_03.gif";
            var logo =document.getElementById('ren');
            logo.src="images/坚果-Pro-2---红---概览_21.gif";
            var logo =document.getElementById('che');
            logo.src="images/坚果-Pro-2---红---概览_22.gif";

        }else if(jia == 2){
            $('#tou,.ertou').css('background-color','#fbfbfb');
            $('#tou div,.ertou div ul li').css('color','#000')
            $('.li').children('li').children('a').css('color','#000')
            var da = document.getElementById('yitu');
            da.className = 'yitu4';
            var logo =document.getElementById('logo1');
            logo.src="images/坚果-Pro-2--白---概览_03.gif";
            var logo =document.getElementById('ren');
            logo.src="images/坚果-Pro-2--白---概览_06.gif";
            var logo =document.getElementById('che');
            logo.src="images/sadf.gif";
        }
    })
    $('#ding').hide()
    $(document).scroll(function () {
        var fangda = $(document).scrollTop();
        console.log(fangda)
        if (fangda > 120) {
            $('#ding').slideDown(500);
        } else if (fangda <= 120) {
            $("#ding").slideUp(500);
        }
        if(fangda>1200){
            $('#tou,.ertou').css('background-color','#fbfbfb');
            $('#tou div,.ertou div ul li').css('color','#000')
            $('.li').children('li').children('a').css('color','#000')
            var da = document.getElementById('yitu');
            da.className = 'yitu4';
            $('#yitu').children('div').children('p').children('span').css('color','#9c8072')
            var logo =document.getElementById('logo1');
            logo.src="images/坚果-Pro-2--白---概览_03.gif";
            var logo =document.getElementById('ren');
            logo.src="images/坚果-Pro-2--白---概览_06.gif";
            var logo =document.getElementById('che');
            logo.src="images/sadf.gif";
        }
        if(fangda>2240){
            $('#tou,.ertou').css('background-color','#000');
            $('#tou div,.ertou div ul li').css('color','#fff')
            $('.li').children('li').children('a').css('color','#fff')
            var da = document.getElementById('yitu');
            da.className = 'yitu2';
            var logo =document.getElementById('logo1');
            logo.src="images/官方在线商城---Smartisan_03.gif";
            var logo =document.getElementById('ren');
            logo.src="images/官方在线商城---Smartisan_06.gif";
            var logo =document.getElementById('che');
            logo.src="images/官方在线商城---Smartisan_08.gif";
        }
        if(fangda > 3300){
            $('#tou,.ertou').css('background-color','#fbfbfb');
            $('#tou div,.ertou div ul li').css('color','#000')
            $('.li').children('li').children('a').css('color','#000')
            var da = document.getElementById('yitu');
            da.className = 'yitu4';
            var logo =document.getElementById('logo1');
            logo.src="images/坚果-Pro-2--白---概览_03.gif";
            var logo =document.getElementById('ren');
            logo.src="images/坚果-Pro-2--白---概览_06.gif";
            var logo =document.getElementById('che');
            logo.src="images/sadf.gif";
        }


    })
    $('.fanding').hide()
    $(document).scroll(function () {
        var fangda = $(document).scrollTop();
        if (fangda>600) {
            $('.fanding').fadeIn(1000)
        } else if (fangda <= 600) {
            $('.fanding').fadeOut(1000)
        }
    });
    $('#tu2').hide()
    $('.fanding').mouseenter(function () {
        $('#tu2').fadeIn(500)
    }).mouseleave(function () {
        $('#tu2').fadeOut(500)
    })
    $('.fanding').click(function () {
        $('body,html').animate({scrollTop:0},500)
    })
})